package com.example.administrator.fragarmentdemotest_a.fragarment_demo;


import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;

import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.MenuItem;

import com.example.administrator.fragarmentdemotest_a.R;
import com.example.administrator.fragarmentdemotest_a.fragarment_demo.Bean.FeatureBean;
import com.example.administrator.fragarmentdemotest_a.fragarment_demo.adapter.RvMoreAdapter;
import com.example.administrator.fragarmentdemotest_a.fragarment_demo.dao.FeatureDao;
import com.example.administrator.fragarmentdemotest_a.utils.app.BaseActivity;

import java.util.Collections;
import java.util.List;

public class MoreActivity extends BaseActivity {
    private RecyclerView rvaa;
    private Toolbar eToolbar;
    Boolean canMove=false;

    @Override
    protected int getLayoutId() {
        return R.layout.more_toast;
    }

    @Override
    protected void initView() {
        eToolbar = findViewById(R.id.toolbar);
        rvaa = findViewById(R.id.rv_open);
        ActionBar actionBar = getSupportActionBar();


    }


    @Override
    protected void initData() {

        //显示toolbar返回按钮
        setSupportActionBar(eToolbar);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);

        }
/////////////////////////////////////////////////
        FeatureDao dao = new FeatureDao();
        List<FeatureBean> listData=dao.findAllOpen();
        List<FeatureBean> close = dao.findAllClose();
        List<FeatureBean> open = dao.findAllOpen();
        RvMoreAdapter adaptera = new RvMoreAdapter(close, open);
        rvaa.setLayoutManager(new LinearLayoutManager(act));
        rvaa.setAdapter(adaptera);
        ///////////////////////////////////////////


    }

    @Override
    protected void initListener() {

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
            case android.R.id.home:
                this.finish();
                Intent intent=new Intent(MoreActivity.this,MainActivity.class);
                startActivity(intent);
                break;
        }
        return super.onOptionsItemSelected(item);
    }

}
